<template>
	<view class="container">
		<view class="status_bar">
			<view style="margin-left: 4%;" @tap="goBack()"><u-icon name="arrow-leftward" size='24' /></view>
			<view style="margin-left: -50upx; font-weight: bold;">群备注</view>
			<view></view>
			</u-icon>
		</view>
		<view class="scroll-view-box" style="width: 90%;margin: 0 auto;">
			<u--textarea v-model="remark" placeholder="请输群备注"></u--textarea>
		</view>
		<u-button @click="getlist" style="width: 90%;margin: 10px auto;" type="primary" text="确定"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newnotice: '',
				userId: uni.getStorageSync('userId') || '',
				startX: 0, // 触摸开始的X坐标
				endX: 0, // 触摸结束的X坐标
				threshold: 50, // 设置滑动多少距离后触发返回  
				hasMore: true, // 是否有更多数据
				info: '',
				remark: ''
			}
		},
		onLoad(options) {

			this.info = JSON.parse(options.groupId)
			console.log(this.info)
		},
		onReachBottom() {
			if (this.hasMore) {
				this.loadMore(); // 调用加载更多方法
			}
		},
		onPullDownRefresh() {
			this.refreshData(); // 调用刷新数据方法
		},
		mounted() {
			this.loadMore(); // 初始化时加载数据
		},
		methods: {
			getlist() {
				uni.request({
					url: this.$api.baseUrl + '/api/group/update-remark',
					header: {
						'content-type': 'application/json'
					},
					data: {
						user_id: uni.getStorageSync('userId'),
						group_id: this.info.g_id,
						remark: this.remark
					},
					method: 'POST',
					success: res => {
						console.log(res);
						uni.hideLoading()
						if (res.data.code == 0) {
							uni.navigateBack({
								delta: 1
							});
						}


						console.log(this.alllist);
					},
					fail: res => {
						console.log(res);
					}

				})
			},
			goBack() {
				uni.navigateBack({
					delta: 1
				});
			},



		}
	}
</script>

<style lang="scss" scoped>
	page {
		overflow: hidden;
	}

	.container {
		width: 100%;
		height: 100%;

	}

	.status_bar {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 50upx;
	}

	.status_bar,
	.head {
		background-color: #fff;
		height: 160upx;
	}

	.shop-box {
		width: 92%;
		margin-left: 4%;
		background-color: #fff;
		margin-top: 20upx;
		border-radius: 20upx;
		padding: 10upx 30upx;

		color: #2e2e2e;
		font-weight: 300;
		display: flex;
		justify-content: space-between;
		align-items: center;

	}

	.name-img {
		width: 120upx;
		height: 120upx;
		border-radius: 10upx;
		background: #d54827;
		font-size: 36upx;
		text-align: center;
		line-height: 120upx;
		color: #fff;
		margin-left: 10upx;
	}
</style>